// 登录
<template>
    <div class="main m-login">
        <label>
            <span>用户名：</span>
            <input type="text" v-model="username" >
        </label>

        <label>
            <span>密码：</span>
            <input type="password" v-model="password">
        </label>

        <label>
            <button @click="login">登录</button>
        </label>

    </div>
</template>

<script>
    import $ from 'jquery';
    export default {
        data: function() {
            return {
                title: '登录',
                username: '',
                password: '',
            }
        },
        methods: {
            login: function() {
                // 做ajax请求
                var url = 'http://localhost:3000/users/login?username=' + this.username + '&pwd=' + this.password;
                $.get(url, function(res) {
                    // console.log(res);
                    if (res && res.code == 0) {
                        // 成功
                    } else {
                        // 失败
                        
                    }
                })
            }
        }
    }
</script>

<style>
    .m-login label {
        display: block;
    }
</style>